Micron Document
🎖️GitЯра🎖️

Node / meshtastic / Meshtastic-Android / files / androidApp / src / google / kotlin / org / meshtastic / app / map / offline / pmtiles / OfflineRegionTileSet.kt

Displaying Raw • Download

androidApp/src/google/kotlin/org/meshtastic/app/map/offline/pmtiles/OfflineRegionTileSet.kt renovate/fastlane-2.x-lockfile (056eed64) Text, 3.44 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.app.map.offline.pmtiles

Tff7b72import T7ee787com.google.android.gms.maps.model.LatLng
Tff7b72import T7ee787com.google.android.gms.maps.model.LatLngBounds

T8b949e/** The standard slippy-map tile enumeration for a region, shared by the download estimate and the extractor. */
Tff7b72internal Tff7b72object T56d364OfflineRegionTileSet Tb4b4b4{

T8b949e/** Every tile in [bounds] across [zoomRange], each zoom level's tiles listed before the next deepens. */
Tff7b72fun Td2a8fftilesTb4b4b4(Te6edf3boundsTb4b4b4: Te6edf3LatLngBoundsTb4b4b4, Te6edf3zoomRangeTb4b4b4: Te6edf3IntRangeTb4b4b4)Tb4b4b4: Te6edf3ListTff7b72<Te6edf3TileIndexTff7b72> Tff7b72=
Te6edf3zoomRangeTb4b4b4.Te6edf3flatMap Tb4b4b4{ Te6edf3zoom Tff7b72-Tff7b72> Te6edf3tilesAtZoomTb4b4b4(Te6edf3boundsTb4b4b4, Te6edf3zoomTb4b4b4) Tb4b4b4}

Tff7b72fun Td2a8ffestimateTileCountTb4b4b4(Te6edf3boundsTb4b4b4: Te6edf3LatLngBoundsTb4b4b4, Te6edf3zoomRangeTb4b4b4: Te6edf3IntRangeTb4b4b4)Tb4b4b4: Tffa657Long Tff7b72=
Te6edf3zoomRangeTb4b4b4.Te6edf3sumOf Tb4b4b4{ Te6edf3zoom Tff7b72-Tff7b72> Te6edf3tilesAtZoomTb4b4b4(Te6edf3boundsTb4b4b4, Te6edf3zoomTb4b4b4)Tb4b4b4.Te6edf3sizeTb4b4b4.Te6edf3toLongTb4b4b4(Tb4b4b4) Tb4b4b4}

Tff7b72private Tff7b72fun Td2a8fftilesAtZoomTb4b4b4(Te6edf3boundsTb4b4b4: Te6edf3LatLngBoundsTb4b4b4, Te6edf3zoomTb4b4b4: Tffa657IntTb4b4b4)Tb4b4b4: Te6edf3ListTff7b72<Te6edf3TileIndexTff7b72> Tb4b4b4{
T8b949e// Northwest corner has the smaller tile-column and smallest tile-row (XYZ rows increase southward);
T8b949e// southeast has the larger of both.
Tff7b72val Te6edf3northwestCorner Tff7b72= Te6edf3LatLngTb4b4b4(Te6edf3boundsTb4b4b4.Te6edf3northeastTb4b4b4.Te6edf3latitudeTb4b4b4, Te6edf3boundsTb4b4b4.Te6edf3southwestTb4b4b4.Te6edf3longitudeTb4b4b4)
Tff7b72val Te6edf3southeastCorner Tff7b72= Te6edf3LatLngTb4b4b4(Te6edf3boundsTb4b4b4.Te6edf3southwestTb4b4b4.Te6edf3latitudeTb4b4b4, Te6edf3boundsTb4b4b4.Te6edf3northeastTb4b4b4.Te6edf3longitudeTb4b4b4)
Tff7b72val Te6edf3northwest Tff7b72= Te6edf3WebMercatorTileMathTb4b4b4.Te6edf3tileAtTb4b4b4(Te6edf3zoomTb4b4b4, Te6edf3northwestCornerTb4b4b4)
Tff7b72val Te6edf3southeast Tff7b72= Te6edf3WebMercatorTileMathTb4b4b4.Te6edf3tileAtTb4b4b4(Te6edf3zoomTb4b4b4, Te6edf3southeastCornerTb4b4b4)

Tff7b72val Te6edf3tiles Tff7b72= Te6edf3mutableListOfTff7b72<Te6edf3TileIndexTff7b72>Tb4b4b4(Tb4b4b4)
Tff7b72for Tb4b4b4(Te6edf3xRange Tff7b72in Te6edf3xRangesAtTb4b4b4(Te6edf3zoomTb4b4b4, Te6edf3northwestTb4b4b4, Te6edf3southeastTb4b4b4)Tb4b4b4) Tb4b4b4{
Tff7b72for Tb4b4b4(Te6edf3x Tff7b72in Te6edf3xRangeTb4b4b4) Tb4b4b4{
Tff7b72for Tb4b4b4(Te6edf3y Tff7b72in Te6edf3northwestTb4b4b4.Te6edf3yTb4b4b4.Tb4b4b4.Te6edf3southeastTb4b4b4.Te6edf3yTb4b4b4) Tb4b4b4{
Te6edf3tiles Tff7b72+Tff7b72= Te6edf3TileIndexTb4b4b4(Te6edf3zoomTb4b4b4, Te6edf3xTb4b4b4, Te6edf3yTb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Tff7b72return Te6edf3tiles
Tb4b4b4}

T8b949e/**
* The largest valid tile-column/row index at [zoom] — `2^zoom - 1`, the same bound [WebMercatorTileMath.tileAt]
* clamps into.
*/
Tff7b72private Tff7b72fun Td2a8ffmaxTileIndexTb4b4b4(Te6edf3zoomTb4b4b4: Tffa657IntTb4b4b4)Tb4b4b4: Tffa657Int Tff7b72= Tb4b4b4(T79c0ff1 Te6edf3shl Te6edf3zoomTb4b4b4) Tff7b72- T79c0ff1

T8b949e/**
* The x-index ranges [tilesAtZoom] must enumerate — normally a single `[northwest.x, southeast.x]` range, but split
* into two (`[northwest.x, maxX]` and `[0, southeast.x]`) when the bounds cross the antimeridian (e.g. west=170,
* east=-170 — real for Fiji, or Chukotka/Alaska): a plain `IntRange` with `start > end` is empty in Kotlin, which
* would otherwise silently enumerate zero tiles for a real, valid region. Same fix as
* [org.meshtastic.feature.map.terrain.TerrainTileMath.tilesAt]'s `xRangesAt`, ported here since this package keeps
* its own tile math rather than depending on that module.
*/
Tff7b72private Tff7b72fun Td2a8ffxRangesAtTb4b4b4(Te6edf3zoomTb4b4b4: Tffa657IntTb4b4b4, Te6edf3northwestTb4b4b4: Te6edf3TileIndexTb4b4b4, Te6edf3southeastTb4b4b4: Te6edf3TileIndexTb4b4b4)Tb4b4b4: Te6edf3ListTff7b72<Te6edf3IntRangeTff7b72> Tff7b72=
Tff7b72if Tb4b4b4(Te6edf3northwestTb4b4b4.Te6edf3x Tff7b72<Tff7b72= Te6edf3southeastTb4b4b4.Te6edf3xTb4b4b4) Tb4b4b4{
Te6edf3listOfTb4b4b4(Te6edf3northwestTb4b4b4.Te6edf3xTb4b4b4.Tb4b4b4.Te6edf3southeastTb4b4b4.Te6edf3xTb4b4b4)
Tb4b4b4} Tff7b72else Tb4b4b4{
Te6edf3listOfTb4b4b4(Te6edf3northwestTb4b4b4.Te6edf3xTb4b4b4.Tb4b4b4.Te6edf3maxTileIndexTb4b4b4(Te6edf3zoomTb4b4b4)Tb4b4b4, T79c0ff0.Tb4b4b4.Te6edf3southeastTb4b4b4.Te6edf3xTb4b4b4)
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.3 - Generated in 0.18s